lm(formula, ...)
## S3 method for class 'default':
lm(formula, data, subset, weights, na.action, method = "qr",
model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
contrasts = NULL, offset, ...)
## S3 method for class 'design':
lm(formula, ..., response=NULL, degree=NULL, FUN=mean,
use.center=NULL, use.star=NULL, use.dummies=FALSE)
aov(formula, ...)
## S3 method for class 'default':
aov(formula, data = NULL, projections = FALSE, qr = TRUE,
contrasts = NULL, ...)
## S3 method for class 'design':
aov(formula, ..., response=NULL, degree=NULL, FUN=mean,
use.center=FALSE)
## S3 method for class 'lm.design':
print(x, ...)
## S3 method for class 'lm.design':
summary(object, ...)
## S3 method for class 'lm.design':
coef(object, ...)
## S3 method for class 'summary.lm.design':
print(x, ...)
## S3 method for class 'aov.design':
print(x, ...)
## S3 method for class 'aov.design':
summary(object, ...)
## S3 method for class 'summary.aov.design':
print(x, ...)
lm.design
summary.lm.design
aov.design
summary.aov.design
lm
,
print.lm
or print.summary.lm
x
;
for wide format repeated measurement or parameter designs,
response
can also be among the column namNULL
,
the default for the formula
method is usedaggregate.design
method;
this must be an unquoted function name;
This option is relevant for repeated measurement designs
and parameter designs in long format oNULL
or logical indicating whether center points are to be used +
in the analysis;
if NULL
, the default is FALSE for pb
and FrF2
designs with
center points and TRUE for ccd
NULL
or logical indicating whether the star portion of a CCD design
is to be used in the analysis (ignored for all other types of designs).
The default TRUE analyses the complete design. Specifying FALSE permits interim analyses oflm
or summary.lm
,
for lm.default
like in lm
lm.design
created by function lm.design
lm
;
its purpose is to call a specific print method that provides slightly more
detail than the standard printout for linear modelssummary.lm
;
its purpose is to call a specific print method that provides slightly more
detail than the standard summary for linear modelslm
lm
lm
lm
lm
lm
lm
lm
lm
lm
lm
lm
functions is a linear model object,
exactly like for function lm
,
except for the added class lm.design
in case of the method for class design
,
and an added list element WholePlotEffects
for split plot designs.
The value for the aov
functions is an aov object,
exactly like for function aov
,
and an added list element WholePlotEffects
for split plot designs.
The value of the summary
functions for class lm.design
and
aov.design
respectively
is a linear model or aov summary, exactly like documented in summary.lm
or summary.aov
,
except for the added classes summary.lm.design
or summary.aov.design
,
and an added list element WholePlotEffects
(for summary.lm.design
)
or attribute (for summary.aov.design
) for split plot designs.
The print functions return NULL
; they are used for their side effects only.lm
and aov
replace the functions
from package match.call(lm)
returns a different result, depending on
whether or not package match.call(stats::lm)
, which always works
in the same way.
Please report any additional issues that you may experience.aov
and lm
methods for class design
conduct a default linear model analysis for data frames of
class design
that do contain at least one response.
The intention for providing default analyses is to support convenient quick inspections.
In many cases, there will be good reasons to customize the analysis, for example by including
some but not all effects of a certain degree. Also, it may be statistically more wise
to work with mixed models for some types of design. The default analyses must not
be taken as a statistical recommendation!
The choice of default analyses
has been governed by simplicity: It uses fixed effects only and does either
main effects models (degree=1
, default for pb
and oa
designs),
models with main effects and 2-factor interactions (degree=2
,
default for most designs) or second order models (that contain
quadratic effects in addition to the 2-factor interactions, unchangeable default
for designs with quantitative variables). The degree
parameter can be used
to modify the degree of interactions. If blocks are
present, the block main effect is always entered as a fixed effect without interactions.
Designs with center points are per default analysed without the center points; the main
reason for this is convenient usage of functions DanielPlot
,
MEPlot
and IAPlot
from package use.center
option, this default can be changed; in this case, significance
of the center point indicator implies that there are one or more quadratic effect(s)
in the model.
Designs with repeated measurements (repeat.only=TRUE
) and parameter
designs of long format are treated by aggregate.design
with aggregation function FUN
(default: means are calculated)
before applying a linear model.
For designs with repeated measurements (repeat.only=TRUE
) and parameter
designs of wide format, the default is to use the first aggregated response,
if the design has been aggregated already. For a so far unaggregated design,
the default is to treat the design by aggregate.design
,
using the function FUN
(default: mean) and then use the first response.
The defaults can be overridden by specifying response
: Here,
response
can not only be one of the current responses but also a column name
of the responselist
element of the design.info
attribute of the
design (i.e. a response name from the long version of the design).
The implementation of the formulae is not done in functions lm.design
or
aov.design
themselves
but based on the method for function formula (formula.design
).
The print
methods prepend the formula and the number of experimental runs
underlying the analysis to the default printout.
The purpose of this is meaningful output in case a call from
inside function lm.design
or aov.design
(methods for functions lm
and aov
)
does not reveal enough information, and another pointer that center points have been
omitted or repeated measurements aggregated over. The coef
method for objects
of class lm.design
suppresses NA
coefficients, i.e.
returns valid coefficients only. For aov
objects, this is the default
anyway.design
and its formula method formula.design
oa12 <- oa.design(nlevels=c(2,2,6))
## add a few variables to oa12
responses <- cbind(y=rexp(12),z=runif(12))
oa12 <- add.response(oa12, responses)
## want treatment contrasts rather than the default
## polynomial contrasts for the factors
oa12 <- change.contr(oa12, "contr.treatment")
linmod.y <- lm(oa12)
linmod.z <- lm(oa12, response="z")
linmod.y
linmod.z
summary(linmod.y)
summary(linmod.z)
## examples with aggregation
plan <- oa.design(nlevels=c(2,6,2), replications=2, repeat.only=TRUE)
y <- rnorm(24)
z <- rexp(24)
plan <- add.response(plan, cbind(y=y,z=z))
lm(plan)
lm(plan, response="z")
lm(plan, FUN=sd)
## wide format
plan <- reptowide(plan)
plan
design.info(plan)$responselist
## default: aggregate variables for first column of responselist
lm(plan)
## request z variables instead (z is the column name of response list)
lm(plan, response="z")
## force analysis of first z measurement only
lm(plan, response="z.1")
## use almost all options
## (option use.center can only be used with center point designs
## from package FrF2)
summary(lm(plan, response="z", degree=2, FUN=sd))
Run the code above in your browser using DataLab